package com.zhanghe.study.spring4.beans.beantest;

import java.util.HashMap;
import java.util.Map;

/**
 * 静态工厂方法：直接调用某一个类的静态方法返回bean的实例
 * @author zh
 * @date 2021/1/5 09:44
 */
public class StaticCarFactory {

    private static Map<String,Car> cars = new HashMap<>();

    static {
        cars.put("aa",new Car("aa",300));
    }

    public static Car getCar(String name){
        return cars.get(name);
    }
}
